
package uestc.bitman.edxapp.mainui;

import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;

public abstract class EdxAppFragment extends Fragment {

    /**
     * @param fragment The fragment which you want to go
     * @param tagString A tag string of the fragment above
     * @param addToBackStack Need to add the fragment to the back stack ?
     */
    public void startFragment(Fragment fragment,int containerViewId, String tagString, boolean addToBackStack) {

        FragmentManager fragmentManager = getActivity().getFragmentManager();
        FragmentTransaction transaction = fragmentManager.beginTransaction();
        transaction.replace(containerViewId, fragment, tagString);
        if (addToBackStack) {
            transaction.addToBackStack(tagString);
        }
        transaction.commit();
    }
}
